<template>
	<div>
		<AplidForm ref="formRef" v-bind="OtherFormConfig" v-model="formModel" @submit="onSubmit"> </AplidForm>
	</div>
</template>

<script setup lang="ts">
import apiMod from '@/apiMod'
import { OtherFormConfig } from '../../config'
import { useCommonStore } from '@/stores/common'

const emit = defineEmits(['refresh'])
const formModel = ref({})
const formRef = ref(null)
const onSubmit = (form, done) => {
	const { tempNowObj } = storeToRefs(useCommonStore())
	const params = {
		...form,
		idCard: tempNowObj.value.idCard,
		code: 1005,
	}
	apiMod
		.view_dpServiceObjectOther_gather(params)
		.then((res) => {
			emit('refresh', res.data)
			done()
		})
		.catch(() => {
			done()
		})
}

const onSave = () => {
	formRef.value!.onSubmit()
}
defineExpose({
	onSave,
})
</script>

<style scoped></style>
